refactor: improve column mapping request handling and add tests for m… - #1235
Conversation
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe column-mapping controller now uses shared middleware to validate request parameters and reject unavailable statutory datasets with 404 errors. ChangesColumn mapping availability
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/unit/columnMappingController.test.js (1)
18-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover an absent
requestDataobject.Add a
{ locals: {} }case asserting the same 404 error. This directly protects the nullishrequestData?.getParams?.()path introduced for unavailable asynchronous request data.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit/columnMappingController.test.js` around lines 18 - 45, Add a third invocation in the test for handleUnavailableColumnMappingRequest using { locals: {} }, then assert that next receives a MiddlewareError with statusCode 404, matching the existing missing-parameter cases and covering the optional requestData path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/unit/columnMappingController.test.js`:
- Around line 18-45: Add a third invocation in the test for
handleUnavailableColumnMappingRequest using { locals: {} }, then assert that
next receives a MiddlewareError with statusCode 404, matching the existing
missing-parameter cases and covering the optional requestData path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1ac10455-782a-4f73-a410-8a3a64c4663f
📒 Files selected for processing (4)
src/controllers/columnMappingController.jssrc/utils/redisLoader.jstest/unit/columnMappingController.test.jstest/unit/redisLoader.test.js
What type of PR is this? (check all applicable)
Description
Fixes column mapping request handling when async request params are missing. The column mapping route now returns a shared 404 “Page not found” error when
organisationNameordatasetis unavailable, andisStatutoryDatasetis defensive against null or missing params.Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Run the focused unit tests and lint checks:
Also manually verify that
/check/column-mapping/:idreturns the shared “Page not found” page when the completed request data does not include bothorganisationNameanddataset.No UI screenshots required.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above. Please refer to the [Digital Land Testing Guidance](https://digital-land.github.io/technical-documentation/development/testing-guidance/) for more information.
[optional] Are there any post deployment tasks we need to perform?
None.
[optional] Are there any dependencies on other PRs or Work?
None.
Summary by CodeRabbit
Bug Fixes
Tests